package gov.kqqzyyy.monkey.tjpd.mytools;

import android.app.DialogFragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;

import gov.kqqzyyy.monkey.tjpd.R;


/**
 * Created by Monkey on 2017/9/18.
 * 自定义progressDialog
 */

public class ProgressDialogFragment extends DialogFragment {

    //        private ProgressBar progressBar;
    private TextView progressText;
    private String message;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {

        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        getDialog().setCancelable(false);
        getDialog().setCanceledOnTouchOutside(false);
        View dialogView = inflater.inflate(R.layout.dialog_progress, container, false);
        onBindDialogUI(dialogView);
        progressText.setText(message);
        return dialogView;
    }

    private void onBindDialogUI(View dialogView) {
//            progressBar = dialogView.findViewById(R.id.progress_dialog_progressbar);
        progressText = dialogView.findViewById(R.id.progress_dialog_message);
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
